home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0015_SERIALNM.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  49 lines

  1. {
  2. >How can [a disk serial number] be read from TP? Can it be changed other than
  3. >by re-Formatting? I can't find any reference to serial number
  4. >in the Dos 5.0 users guide except a passing one in the section
  5. >on the ForMAT command.
  6. }
  7. Uses Dos;
  8. Var  regs : Registers;
  9.      LabelInfo : Record
  10.        InfoLevel : Word;    {Always 0}
  11.        SerialNum : LongInt;
  12.        VolumeLabel : Array [1..11] of Char;
  13.        FileSystemType : Array [1..8] of Char;
  14.      end;
  15. begin
  16.  
  17.   if lo(DosVersion)<4 then
  18.     begin
  19.       Writeln ('Only works With Dos 4.0 or higher');
  20.       Exit;
  21.     end;
  22.  
  23.   LabelInfo.InfoLevel := 0;       {Set Info level (0 is the only legal value)}
  24.   With regs do
  25.      begin
  26.        ax := $6900;  {Function $69 With 0 in AL gets, With 1 in AL sets}
  27.        bl := 0;      {Drive, 0 For default, 1 For A:, 2 For B:, ...}
  28.        ds := seg(LabelInfo);  {DS:DX points at structure}
  29.        dx := ofs(LabelInfo);
  30.        es := 0;      {Do not have garbage in segment Registers}
  31.        flags := 0;   {  or in flags}
  32.  
  33.        MsDos(Regs);
  34.  
  35.        if Odd(flags) then   {Carry set if error}
  36.          begin
  37.              Case AX of
  38.                1:  Writeln ('Illegal attempt to get Label from network drv');
  39.                5:  Writeln ('No Extended BPB on disk (Format old)');
  40.              else  Writeln ('Unknown error');
  41.              end;
  42.          end;
  43.     end;
  44.  
  45. {On return, fills SerialNum, VolumeLabel, and FileSystemType fields.
  46.   places 'FAT12   ' or 'FAT16   ' in FileSystemType, For 12- or 16-bit FAT
  47. entries.  With AL=1, will use info you store in LabelInfo to set disk's
  48. extended BPB}
  49.